<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h1>文件上传</h1>
    <input type="file" id="file">
    <button type="button" onclick="test()">测试</button>
</body>
<script src="../../assets/js/jquery.min.js"></script>
<script src="../../assets/js/skel.min.js"></script>
<script src="../../assets/js/util.js"></script>
<!--[if lte IE 8]>
<script src="../../assets/js/ie/respond.min.js"></script><![endif]-->
<script src="../../assets/js/main.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/demo.js"></script>

<script type="text/javascript" >

    //文件分片
    let shardSize = 20 * 1024 * 1024; //20mb为一个分片
    let shardIndex = 0; //分片索引
    let start = shardIndex * shardSize;//当前分片起始位置
    let end = Math.min(file.size,start + shardSize);//当前分片结束位置
    let fileShard = file.slice(start,end);//从文件中截取当前的分片数据

    formData.append('file',fileShard);
    formData.append('use',_this.use);

    function test() {
        $.ajax({
            type: 'GET',
            url:"/blog/test",
            async: false,
            success:function (data) {
                if (data.code == 200){
                    console.log(data)
                }else {

                }
            }
        })
        location.reload();
    }

</script>

</html>